package com.ltx.blog_ltx.entity.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class BlogDto implements Comparable<BlogDto>{
    private int blogId;            //博客id
    private String blogTitle;       //博客标题
    private int pageView;           //博客浏览量
    private int blogCollect;        //博客收藏量
    private int blogLike;           //博客点赞量
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;        //博客创建时间
    private String userName;             //userId
    private String userHead;             //用户头像
    private String blogSortName;         //博客分类
    private String bolgNote;       //博客简介


    @Override
    public int compareTo(BlogDto o) {
        int quanzhon1=(int)(this.pageView*0.15+this.blogCollect*0.5+this.blogLike*0.35);
        int quanzhon0=(int)(o.pageView*0.15+o.blogCollect*0.5+o.blogLike*0.35);
        return quanzhon0-quanzhon1;
    }
}
